package com.cgy.utils.netx.ftp;

import org.apache.camel.Processor;

/**
 * ftp
 * @author CHTK
 */
public class FtpRoute {

    private static final String FTP = "ftp";
   // private static final String SFTP = "sftp";

    private String address;
    private String username;
    private String password;
    private long delay = 60000;
    private Processor processor;
    private String to;

    /**
     *
     * @return
     */
    public static FtpRoute newRoute() {
        return new FtpRoute();
    }

    /**
     * 账号
     * @param username
     * @return
     */
    public FtpRoute username(final String username) {
        this.username = username;
        return this;
    }
    /**
     * 延迟
     * @param delay
     * @return
     */
    public FtpRoute delay(final long delay) {
        this.delay = delay;
        return this;
    }
    /**
     * 监视器
     * @param processor
     * @return
     */
    public FtpRoute processor(final Processor processor) {
        this.processor = processor;
        return this;
    }
    /**
     * 密码
     * @param password
     * @return
     */
    public FtpRoute password(final String password) {
        this.password = password;
        return this;
    }
    /**
     * 账号密码
     * @param username
     * @param password
     * @return
     */
    public FtpRoute usernameAndPassword(final String username, final String password) {
        this.username = username;
        this.password = password;
        return this;
    }
    /**
     * ftp地址
     * @param address
     * @return
     */
    public FtpRoute address(final String address) {
        this.address = address;
        return this;
    }
    /**
     * 存放地址
     * @param to
     * @return
     */
    public FtpRoute to(final String to) {
        this.to = to;
        return this;
    }

    /**
     *
     */
    public void ftp() {


    }

    /**
     * 真实地址
     * @return
     */
    public String realUrl() {
        StringBuilder stringBuilder = new StringBuilder(FTP);
        stringBuilder.append("://").append(address).append("?");
        stringBuilder.append("username=").append(username).append("&");
        stringBuilder.append("password=").append(password).append("&");
        stringBuilder.append("binary=true&passiveMode=true&delete=true&");
        stringBuilder.append("delay=").append(delay);
        if(null != processor) {
        }
        return stringBuilder.toString();
    }
    /**
     * 存放地址
     * @return
     */
    public String realTo() {
        return this.to;
    }
}
